package com.ellfors.common.ext

import com.ellfors.common.utils.JsonUtil

fun Any?.objToJson(): String? {
    this ?: return null
    return JsonUtil.obj2Json(this)
}

inline fun <reified T> String?.jsonToObj(): T? {
    this ?: return null
    return JsonUtil.json2Obj(this, T::class.java)
}

inline fun <reified T> String?.jsonToList(): ArrayList<T> {
    this ?: return arrayListOf()
    return JsonUtil.json2List(this, T::class.java)
}